Skip to main content

Default Arguments

During a function declaration, parameters can now declare their own default value.

Example Code
pluto
local function write(text = "No text provided.")
print(text)
end
write() --> No text provided.
write("Hello!") --> Hello!
This code behaves identically.
pluto
local function write(text)
if text == nil then
text = "No text provided."
end
print(text)
end
write() --> No text provided.
write("Hello!") --> Hello!